#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 120;
#define INF 0x7fffffff
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
void solve()
{
	int n;
	sd(n);
	bool ok = false;
	bool judge = false;
	int sz_zero = 0;
	int num = 0;
	unordered_map<int, int> cnt;
	for (int i = 0; i < n; i++)
	{
		int t;sd(t);
		if (!t) ok = true, sz_zero++;
		cnt[t]++;
		if (t) num++;
	}

	if (ok)
	{
		pd(n - sz_zero); puts("");
		return;
	}
	else
	{
		for (auto [k, v] : cnt)
			if (v>= 2)
			{
				judge = true;
				break;
			}
	}
	if (judge) pd(num + 1 - 1);//一次把相同的变成0其他n-1重复变成0
	else pd(num + 1);
	puts("");
}


int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}